//package com.aistar.interceptor;
//
//import com.aistar.xfxy.pojo.Customer;
//import org.springframework.web.servlet.HandlerInterceptor;
//import org.springframework.web.servlet.ModelAndView;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import javax.servlet.http.HttpSession;
//
///**
// * 登录拦截器
// */
//public class LoginInterceptor implements HandlerInterceptor {
//
//
//    //检查登录业务拦截器，是在执行请求之前就需要拦截的，所以写在preHandle方法中
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        HttpSession session = request.getSession();
//        Customer customer = (Customer) session.getAttribute("loginUser");
//        if(customer == null){
//            System.out.println("拦截器已拦截，用户尚未登录，请先登录");
//            //重定向到登录界面
//            response.sendRedirect(request.getContextPath()+"/member/land.jsp");
//            return false;
//        }
//        System.out.println("用户已经登录，放行");
//        return true;
//    }
//
//    @Override
//    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//
//    }
//
//    @Override
//    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//
//    }
//}
